{% extends '::base.html.twig' %} 
{% block title %}Embargos :: Nuevo{% endblock %}

{% block module_name %}Embargos{% endblock %}

{% block body %}
<h2>Formulario</h2>
<div class="widget_inside records_list">
    <div class="form">
        <form action="{{ path('embargos_create') }}" method="post" {{ form_enctype(form) }} id="formID">
            <input type="hidden" name="idContrato" value="{{contrato.id}}" />
            <div class="clearfix">
                <label>Periodo de Causaci&oacute;n</label>
                <div class="input">
                    <select name="idPeriodoLaboral">
                        {% for periodo in periodos %}
                            <option value="{{ periodo.id }}">{{ periodo.idPeriodo.comentarios }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>
            <div class="clearfix">
                <label>Empleado</label>
                <div class="input"><input type="text" value="{{contrato.idTrabajador.nombres}} {{contrato.idTrabajador.apellidos}}" readonly /></div>
            </div>
            {{ form_widget(form) }}
            <div class="clearfix grey-highlight">
                <div class="input no-label">
                    <button type="submit" class="button blue">Guardar</button>
                                            <a href="{{ path('embargos') }}" class="button">Regresar a la Lista</a>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    $(document).ready(function(){ 
        var montoTotal = $("#rebecca_rebeccabundle_embargostype_montoTotal").parent().parent();
        var porcentaje = $("#rebecca_rebeccabundle_embargostype_porcentaje").parent().parent();
        
        function check(){
            if($("#rebecca_rebeccabundle_embargostype_clase").val() == 1){
                montoTotal.hide();
                porcentaje.show().effect("highlight", {}, 1000);
            }else{
                montoTotal.show().effect("highlight", {}, 1000);
                porcentaje.hide();
            }
        }
        check();
        $('#rebecca_rebeccabundle_embargostype_clase').live('change', function(){
            check();
       });
    });
</script>
{% endblock %}